Skip to content

Web 1039 playwright client lifecycle happy paths e 2 e specs#3725

Merged
IOhacker merged 1 commit into
openMF:devfrom
devvaansh:WEB-1039-web-playwright-client-lifecycle-happy-path-e-2-e-specs
Jul 24, 2026
Merged

Web 1039 playwright client lifecycle happy paths e 2 e specs#3725
IOhacker merged 1 commit into
openMF:devfrom
devvaansh:WEB-1039-web-playwright-client-lifecycle-happy-path-e-2-e-specs

Conversation

@devvaansh

@devvaansh devvaansh commented Jul 16, 2026

Copy link
Copy Markdown
Member

Description

Added Playwright end-to-end specs covering all five client lifecycle state transitions. Previously there was zero automated coverage of the client lifecycle

Each spec follows the pattern: API sets up the predecessor state → Playwright drives the UI transition → asserts both the snackbar message (UI layer) and GET /clients/{id} status + timeline (API layer). The dual assertion ensures the backend state actually changed, not just the UI.

Screenshot 2026-07-16 at 6 42 35 PM

Transitions covered:

  • Pending → Active (activate.spec.ts)
  • Pending → Rejected (reject.spec.ts)
  • Rejected → Pending via Undo Rejection (undo-rejection.spec.ts)
  • Pending → Withdrawn (withdraw.spec.ts)
  • Closed → Pending via Reactivate (reactivate-after-close.spec.ts)

Dependencies: Requires WEB-1037(#{WEB-1037 PR number}) to be merged first — this PR depends on the client action page objects, seeded factory, and ApiSetupManager introduced there.


Related issues and discussion

#WEB-1039 https://mifosforge.jira.com/browse/WEB-1039


Screenshots, if any

Screen.Recording.2026-07-25.at.12.20.25.AM.mov

Checklist

  • If you have multiple commits please combine them into one commit by squashing them.
  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

Summary by CodeRabbit

  • Tests
    • Added new Playwright end-to-end coverage for client lifecycle flows: Activate (Pending → Active), Reject (Pending → Rejected), Undo Rejection (Rejected → Pending), Withdraw (Pending → Withdrawn), and Reactivate After Close.
    • Each spec drives the UI actions and verifies success messaging plus the resulting backend client status and timeline date entries.

@devvaansh
devvaansh requested a review from a team July 16, 2026 13:01
@devvaansh devvaansh changed the title Web 1039 web playwright client lifecycle happy path e 2 e specs Web 1039 playwright client lifecycle happy paths e 2 e specs Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "pre_merge_checks"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Adds Playwright E2E coverage for client lifecycle transitions: activation, rejection, withdrawal, reactivation after closure, and undoing rejection. Tests combine UI actions with API assertions for status and timeline changes.

Changes

Client lifecycle testing

Layer / File(s) Summary
Pending client lifecycle actions
playwright/tests/clients/lifecycle/activate.spec.ts, playwright/tests/clients/lifecycle/reject.spec.ts, playwright/tests/clients/lifecycle/withdraw.spec.ts
Adds E2E coverage for Pending clients transitioning to Active, Rejected, or Withdrawn, including snackbar, status, and timeline assertions.
Closed and rejected client reversals
playwright/tests/clients/lifecycle/reactivate-after-close.spec.ts, playwright/tests/clients/lifecycle/undo-rejection.spec.ts
Adds E2E coverage for returning Closed or Rejected clients to Pending and validates cleared or preserved timeline fields.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • openMF/web-app#3686: Adds or changes the createTestClient() factory and related test fixtures used by these specs.
  • openMF/web-app#3699: Introduces Playwright infrastructure used by the lifecycle tests, including client setup and authentication initialization.
  • openMF/web-app#3722: Adds client action page objects, selectors, and seeded state helpers for these lifecycle flows.

Suggested reviewers: iohacker

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is clearly related to the PR’s main change: adding Playwright client lifecycle happy-path e2e specs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
playwright/utils/api-setup-manager.ts (1)

184-184: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid using any for API response types.

The getClientTemplate method returns Promise<any>. Based on learnings, you should introduce specific interfaces or types for API response shapes rather than using any. If typing the entire API response layer is too broad for this PR, please track it as a separate enhancement backlog item.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playwright/utils/api-setup-manager.ts` at line 184, Replace the Promise<any>
return type on getClientTemplate with a specific interface or response type
matching the API payload shape, and update the method implementation as needed
to satisfy it. Avoid broad any usage; if the full response layer cannot be typed
within this change, record that broader work as a separate enhancement backlog
item.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@playwright/factories/client.ts`:
- Around line 137-188: The cleanup function is currently defined too late to
remove clients when a post-creation reason lookup or state transition fails.
Move the cleanup definition immediately after resolving clientId, wrap the state
transition switch in a catch that awaits cleanup before rethrowing the original
error, and preserve the existing cleanup behavior and returned cleanup handle.

In `@playwright/tests/clients/lifecycle/illegal-transitions.spec.ts`:
- Line 206: Add the missing non-throwing tryExecuteClientCommand method to
FineractApiClient, accepting clientId, command, and payload, posting to the
client command endpoint, and returning the ok, status, and bodyText fields
consumed by the lifecycle spec. Preserve the raw response status and text while
avoiding exceptions for unsuccessful responses.
- Around line 26-31: Add UI coverage in illegal-transitions.spec.ts that
arranges each predecessor client state, opens the actions menu through
ClientViewPage, and asserts the disallowed action is absent using stable
selectors. Keep the existing API-only transition matrix unchanged as separate
backend enforcement coverage, and structure the new checks with clear
Arrange-Act-Assert phases and minimal timing assumptions.

---

Nitpick comments:
In `@playwright/utils/api-setup-manager.ts`:
- Line 184: Replace the Promise<any> return type on getClientTemplate with a
specific interface or response type matching the API payload shape, and update
the method implementation as needed to satisfy it. Avoid broad any usage; if the
full response layer cannot be typed within this change, record that broader work
as a separate enhancement backlog item.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d85030c8-f30c-4c2f-bac0-5bd067e94dce

📥 Commits

Reviewing files that changed from the base of the PR and between a2cbe85 and 46f0c39.

📒 Files selected for processing (20)
  • playwright.config.ts
  • playwright/config/selectors.ts
  • playwright/factories/client.spec.ts
  • playwright/factories/client.ts
  • playwright/factories/index.ts
  • playwright/fixtures/fineract-api.ts
  • playwright/pages/client-actions/activate-client.page.ts
  • playwright/pages/client-actions/reactivate-client.page.ts
  • playwright/pages/client-actions/reject-client.page.ts
  • playwright/pages/client-actions/transfer-client.page.ts
  • playwright/pages/client-actions/withdraw-client.page.ts
  • playwright/pages/index.ts
  • playwright/tests/clients/lifecycle/activate.spec.ts
  • playwright/tests/clients/lifecycle/illegal-transitions.spec.ts
  • playwright/tests/clients/lifecycle/reactivate-after-close.spec.ts
  • playwright/tests/clients/lifecycle/reject.spec.ts
  • playwright/tests/clients/lifecycle/undo-rejection.spec.ts
  • playwright/tests/clients/lifecycle/withdraw.spec.ts
  • playwright/utils/api-setup-manager.spec.ts
  • playwright/utils/api-setup-manager.ts

Comment thread playwright/factories/client.ts
Comment thread playwright/tests/clients/lifecycle/illegal-transitions.spec.ts Outdated
Comment thread playwright/tests/clients/lifecycle/illegal-transitions.spec.ts Outdated
@devvaansh
devvaansh force-pushed the WEB-1039-web-playwright-client-lifecycle-happy-path-e-2-e-specs branch 2 times, most recently from 588e161 to 4623b9f Compare July 16, 2026 13:39
@devvaansh
devvaansh marked this pull request as draft July 16, 2026 13:44
@devvaansh
devvaansh force-pushed the WEB-1039-web-playwright-client-lifecycle-happy-path-e-2-e-specs branch from 4623b9f to 55facad Compare July 24, 2026 18:22
@devvaansh
devvaansh marked this pull request as ready for review July 24, 2026 18:28
@devvaansh
devvaansh force-pushed the WEB-1039-web-playwright-client-lifecycle-happy-path-e-2-e-specs branch from 55facad to c19dba9 Compare July 24, 2026 18:28
Adds 5 happy-path specs under playwright/tests/clients/lifecycle/:
- activate.spec.ts              — Pending → Active
- reject.spec.ts                — Pending → Rejected
- undo-rejection.spec.ts        — Rejected → Pending (Undo Rejection)
- withdraw.spec.ts              — Pending → Withdrawn
- reactivate-after-close.spec.ts — Closed → Pending (Reactivate)

Each spec: API arrange → UI act → snackbar assert + GET /clients/{id}
status assert + timeline entry check. All 5 pass locally.
@devvaansh
devvaansh force-pushed the WEB-1039-web-playwright-client-lifecycle-happy-path-e-2-e-specs branch from c19dba9 to 647e4a4 Compare July 24, 2026 21:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
playwright/tests/clients/lifecycle/undo-rejection.spec.ts (1)

60-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move the Undo Rejection date field out of the spec.

input[formcontrolname="reopenedDate"] locks this E2E test to an Angular form control, and waitFor({ state: 'visible', timeout: 30000 }) adds a brittle 30-second delay instead of asserting readiness normally. Add a stable data-testid for the Undo Rejection reopenedDate field and use an assertion-based locator, ideally through the client-action page object.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playwright/tests/clients/lifecycle/undo-rejection.spec.ts` around lines 60 -
63, The Undo Rejection date interaction is coupled to an Angular form-control
selector and an explicit wait. Add a stable data-testid to the reopenedDate
field, expose or reuse it through the client-action page object, and update the
test to locate it there and use an assertion-based readiness check before
filling and blurring, removing the 30-second waitFor call.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@playwright/tests/clients/lifecycle/reject.spec.ts`:
- Around line 20-21: Update the lifecycle test documentation near the listed
assertions to reference preservation of submittedOnDate rather than an assertion
of rejectedOnDate, accurately reflecting the API response and existing test
behavior.

---

Nitpick comments:
In `@playwright/tests/clients/lifecycle/undo-rejection.spec.ts`:
- Around line 60-63: The Undo Rejection date interaction is coupled to an
Angular form-control selector and an explicit wait. Add a stable data-testid to
the reopenedDate field, expose or reuse it through the client-action page
object, and update the test to locate it there and use an assertion-based
readiness check before filling and blurring, removing the 30-second waitFor
call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 02519824-879a-4975-a985-b58d1c3d126c

📥 Commits

Reviewing files that changed from the base of the PR and between c19dba9 and 647e4a4.

📒 Files selected for processing (5)
  • playwright/tests/clients/lifecycle/activate.spec.ts
  • playwright/tests/clients/lifecycle/reactivate-after-close.spec.ts
  • playwright/tests/clients/lifecycle/reject.spec.ts
  • playwright/tests/clients/lifecycle/undo-rejection.spec.ts
  • playwright/tests/clients/lifecycle/withdraw.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • playwright/tests/clients/lifecycle/withdraw.spec.ts
  • playwright/tests/clients/lifecycle/reactivate-after-close.spec.ts

Comment thread playwright/tests/clients/lifecycle/reject.spec.ts

@IOhacker IOhacker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IOhacker
IOhacker merged commit 22db27c into openMF:dev Jul 24, 2026
5 checks passed
@devvaansh
devvaansh deleted the WEB-1039-web-playwright-client-lifecycle-happy-path-e-2-e-specs branch July 24, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants